@extends('base')
@section('style')
<style type="text/css">
        @if('zh_cn' == Cookie::get('lang'))
            .title{text-align: left;text-indent: 2.6em !important;}
        @endif    
</style>
@stop
@section('content')
    <ul class="footprint">
        <li><a href="#">{{trans('base.HOME')}}</a></li>
        <li><a href="#">&gt;&gt;</a></li>
        <li><a href="#">{{trans('base.PRODUCTS')}}</a></li>
        @if(isset($class['pk']))
            <li><a href="#">&gt;&gt;</a></li>
            <li><a href="#">{{$class['pk']}}</a></li>
        @endif
        @if(isset($class['ck']))
            <li><a href="#">&gt;&gt;</a></li>
            <li><a href="#">{{$class['ck']}}</a></li>
        @endif
    </ul>
    <div class="contant mttop">
        <div class="fl">
            <h2 class="title yin_font2">{{trans('base.PRODUCTS')}}</h2>
            <div class="left_nav">
                <ul class="productGroup">
                    @foreach($types as $key=>$type)
                        <li><a class="type_show" id="p_a_{{$key}}" href="{{url('product/index/?pk='.$key)}}">{{$type['name']}}</a>
                            @if([] != $type['data'])
                                <ul class="product_nav" style="display: none">
                                    @foreach($type['data'] as $datakey=>$data)
                                        <li><a id="c_a_{{$datakey}}" href="{{url('product/index/?pk='.$key.'&ck='.$datakey)}}"
                                               @if($typeShow == $datakey) class="pro_nav_ative" @endif>{{$data}}</a>
                                        </li>
                                    @endforeach
                                </ul>
                            @endif
                        </li>
                    @endforeach
                </ul>
            </div>
        </div>

        <div class="contact_right">
            <ul class="index_cp">
                @foreach($products as $product)
                    <li>
                        <a href="{{url('product/detail/'.$product->id)}}">
                            <?php $pic = explode(',', $product->pic)[0] ?>
                            <img src="{{asset('img/type-'.$pic.'/180-180"')}}"/>
                            <p>{{"zh_cn" == $lang ? $product->name_cn : $product->name}}</p>
                        </a>
                    </li>
                @endforeach
            </ul>

            @if ($products->hasPages())
                <div class="page">
                    <p class="page_on"><a href="{{$products->previousPageUrl()}}">{{trans('base.PREV')}}</a></p>
                    {!! $products->appends($params)->render() !!}
                    <p class="page_under"><a href="{{$products->nextPageUrl()}}">{{trans('base.NEXT')}}</a></p>
                </div>
            @endif
        </div>
    </div>
@stop
@section('js')
    <script type="text/javascript" src="{{asset('/js/common.js')}}"></script>
    <script>
        $(function () {
//            $('.pro_nav_ative').parent().parent().show();
            var pk  = getUrlParam("pk");
            var ck = getUrlParam("ck");
            $("#p_a_" + pk).parent().siblings().find('li ul').slideUp(200);
            $("#p_a_" + pk).next().slideDown(200);
            $("#p_a_" + pk).toggleClass('arrowdown');
        })
    </script>
@stop